#!/bin/sh

. $LKP_SRC/lib/env.sh
. $LKP_SRC/lib/debug.sh

# These events are based on https://lwn.net/Articles/569674/
events=$($LKP_SRC/bin/perf-events 'power/energy-*')
[ -n "$events" ] || die "Events are empty"

set_perf_path "/lkp/benchmarks/perf/perf"
export perf

opt_events="-e $(echo $events | sed 's/ / -e /g')"

take_snapshot()
{
	$perf stat -a -x' ' $opt_events 2>&1 -- $1
}

. $LKP_SRC/lib/wait.sh
setup_wait

echo time: $(date +%s.%N)
take_snapshot "$WAIT_POST_TEST_CMD"
echo time: $(date +%s.%N)
